package cn.edu.abtu.controller;

import cn.edu.abtu.service.VodService;
import cn.edu.abtu.vo.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/eduvod/video")
public class VodController {

    @Autowired
    private VodService vodService;

    @PostMapping("/uploadVideo")
    public ResponseData uploadVideo(MultipartFile file){
        return vodService.uploadVideo(file);
    }

    //根据视频ID删除阿里云视频
    @DeleteMapping("/removeVideo/{videoId}")
    public ResponseData removeVideo(@PathVariable String videoId){
        return vodService.removeVideo(videoId);
    }

    //根据视频ID的List进行批量删除
    @DeleteMapping("delete-batch")
    public ResponseData deleteBatch(@RequestParam("videoList") List<String> videoList){
        return vodService.deleteBatch(videoList);
    }

    @GetMapping("/getPlayAuth/{videoId}")
    public ResponseData getPlayAuth(@PathVariable String videoId){
        return vodService.getPlayAuth(videoId);
    }

}
